#coding=utf-8
import  urllib2
from numpy import genfromtxt,zeros
import matplotlib
from pylab import plot,show,figure,subplot,hist,xlim

url = 'http://aima.cs.berkeley.edu/data/iris.csv'
u = urllib2.urlopen(url)
localFile = open('iris.csv','w')
localFile.write(u.read())
localFile.close()

data = genfromtxt('iris.csv',delimiter=',',usecols=(0,1,2,3))
target = genfromtxt('iris.csv',delimiter=',',usecols=(4),dtype=str)

plot(data[target == 'setosa',0],data[target == 'setosa',2],'bo')
plot(data[target == 'versicolor',0],data[target == 'versicolor',2],'ro')
plot(data[target == 'virginica',0],data[target == 'virginica',2],'go')

show()
